package com.merelyb.data.service.service.service.affpay;

import com.merelyb.data.service.common.MultiDataSourceContextHolder;
import com.merelyb.data.service.service.mybatis.bean.affpay.AffpayPaymethod;
import com.merelyb.data.service.service.mybatis.dao.affpay.AffpayPaymethodDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by LiM on 2017/12/15.
 */
@Service
public class AffpayPaymethodService {
    @Autowired
    AffpayPaymethodDao affpayPaymethodDao;


    /**
     * 查询数据
     *
     * @param affpayPaymethod
     * @return
     * @throws Exception
     */
    public List<AffpayPaymethod> queryAllList(AffpayPaymethod affpayPaymethod) throws Exception {
        return affpayPaymethodDao.queryAllList(affpayPaymethod, MultiDataSourceContextHolder.DATA_AFFPAY);
    }

    /**
     * 分页查询数据
     *
     * @param affpayPaymethod
     * @return
     */
    public List<AffpayPaymethod> queryListByLimit(AffpayPaymethod affpayPaymethod) {
        return affpayPaymethodDao.queryListByLimit(affpayPaymethod, MultiDataSourceContextHolder.DATA_AFFPAY);
    }

    /**
     * 新增单条数据
     *
     * @param affpayPaymethod
     * @throws Exception
     */
    public void addData(AffpayPaymethod affpayPaymethod) throws Exception {
        affpayPaymethodDao.addData(affpayPaymethod, MultiDataSourceContextHolder.DATA_AFFPAY);
    }

    /**
     * 批量新增数据
     *
     * @param affpayPaymethodList
     * @throws Exception
     */
    public void addData(List<AffpayPaymethod> affpayPaymethodList) throws Exception {
        affpayPaymethodDao.addData(affpayPaymethodList, MultiDataSourceContextHolder.DATA_AFFPAY);
    }

    /**
     * 更新数据
     *
     * @param affpayPaymethod
     * @throws Exception
     */
    public void updateData(AffpayPaymethod affpayPaymethod) throws Exception {
        affpayPaymethodDao.updateData(affpayPaymethod, MultiDataSourceContextHolder.DATA_AFFPAY);
    }

    /**
     * 更新数据状态
     *
     * @param affpayPaymethod
     * @throws Exception
     */
    public void deleteData(AffpayPaymethod affpayPaymethod) throws Exception {
        affpayPaymethodDao.deleteData(affpayPaymethod, MultiDataSourceContextHolder.DATA_AFFPAY);
    }

    /**
     * 统计数量
     *
     * @param affpayPaymethod
     * @return
     */
    public int getCount(AffpayPaymethod affpayPaymethod) {
        return affpayPaymethodDao.getCount(affpayPaymethod, MultiDataSourceContextHolder.DATA_AFFPAY);
    }

    /**
     * 获取所有支付方式
     *
     * @param affpayPaymethod
     * @return
     * @throws Exception
     */
    public List<String> getAllPayMethods(AffpayPaymethod affpayPaymethod) throws Exception {
        return affpayPaymethodDao.getAllPayMethod(affpayPaymethod, MultiDataSourceContextHolder.DATA_AFFPAY);
    }
}
